gl path "~/Dropbox/CovidTurnout/replication"

// declare dependencies


set scheme plotplain
use "$path/original_data/analysis_file.dta", clear
keep if inlist(age, 64, 65)


collapse voted absentee [fw=obs], by(year age elec_type)
reshape wide voted absentee, i(year elec_type) j(age)


// general

* Plot trends in turnout
twoway (connected voted64 year, lc(gs10) mc(gs10) m(circle)) ///
	(connected voted65 year, lc(gs2) mc(gs2) m(triangle)) ///
	if elec_type=="general", ///
	text(60 2014.3 "65 Years Old") text(50 2015.7 "64 Years Old") ///
	xti("Year") yti("Votes per 100 Residents") ///
	legend(off) ///
	scheme(s2color) graphregion(color(white)) scale(1.5)
graph export "$path/output/turnout_trends_general.pdf", replace
	
* Plot trends in absentee voting
twoway (connected absentee64 year, lc(gs10) mc(gs10) m(circle)) ///
	(connected absentee65 year, lc(gs2) mc(gs2) m(triangle)) ///
	if elec_type=="general", ///
	text(1.3 2016 "64 Years Old") text(4 2016 "65 Years Old") ///
	xti("Year") yti("Absentee per 100 Residents") legend(off) ///
	scheme(s2color) graphregion(color(white)) scale(1.5)
graph export "$path/output/absentee_trends_general.pdf", replace


project , creates("$path/output/turnout_trends_general.pdf")
